#pragma once

#include "..\\ExternalTools\\ExternalTools.h"

#include "..\\Loirey\\loirey_GLOBAL.h"
#include "..\\Loirey\\loirey_BasicStructure.h"

using namespace loirey;

class CFeatureStructureTree
{
public:
	class CNode
	{
	public:
		int SelfNodeIndex, ParentNodeIndex;
		int BrotherIndex, LayerIndex;
	public:
		int FeatureGroupAmount;
		int FeatureSize_AllGroup;
		int FeatureSize_SingleGroup;
		int FeatureStartOffSetInGroup;
	public:
		int ChildrenAmount;
		CSimpleTypeArray<int> ChildrenNodeIndexList;
	};

public:
	class CSelectedFeature
	{
	public:
		int FeatureIndex;
		int RealDepth;
		CSimpleTypeArray<int> List_PerLayer_BrotherIndex;
		CSimpleTypeArray<int> List_PerLayer_GroupIndex;
		CSimpleTypeArray<int> List_PerLayer_NodeIndex;
	};

public:
	int Root, NodeAmount, LayerAmount, FeatureDimension;
	CSimpleTypeArray<CNode> NodeList;

public:
	CFeatureStructureTree();
	void Clear();
	void myInit(string strFN_FeatureStructureTree);
	CNode& MakeTree(int ParentIndex, istream& inFile);
	CNode& MakeNode(int ParentNodeIndex);
public:
	void SelectFeature(CSelectedFeature& DstDimension, int FeatureIndex) const;
};

